package forList;

/**
 * @author hanj.cn@outlook.com
 */
public class ArrayCopy {

    public static void main(String[] args) {

        int[] a = new int[10];
        a[0] = 0;
        a[1] = 1;
        a[2] = 2;
        a[3] = 3;
        a[4] = 4;

        int[] b = new int[10];
        b[0] = 9;
        b[1] = 8;
        b[2] = 7;
        b[3] = 6;
        b[4] = 5;

        System.out.println("替换前:");
        for (int i : a) {
            System.out.print(i + "\t");
        }
        System.out.println();
        for (int i : b) {
            System.out.print(i + "\t");
        }
        System.out.println("\n替换后:");
        System.arraycopy(a, 1, b, 2, 3);
        for (int i : b) {
            System.out.print(i + "\t");
        }
    }

}

